package edu.bbu.BS.api;

import javax.ejb.Local;
import javax.ejb.Stateless;

import edu.bbu.bs.backend.dtos.AuthorDTO;
import edu.bbu.bs.backend.model.Author;

@Stateless
@Local
public class AuthorConverter {
	public Author DTOToModel(AuthorDTO authorDTO) {
		Author author = new Author();

		author.setId(authorDTO.getId());
		author.setFirstName(authorDTO.getFirstName());
		author.setLastName(authorDTO.getLastName());

		return author;
	}

	public AuthorDTO ModelToDTO(Author author) {
		AuthorDTO authorDTO = new AuthorDTO();

		authorDTO.setId(author.getId());
		authorDTO.setFirstName(author.getFirstName());
		authorDTO.setLastName(author.getLastName());

		return authorDTO;
	}
}
